<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #box1{
            width: 260px;
            height: 180px;
            border: 1px solid #ccc;
            padding: 20px;
            overflow: hidden;
        }
        /* css3引入的"vw"和"vh"基于宽度/高度相对于窗口大小，"vw"="view width", “vh"="view height"; 
            100vw就是浏览器内部的可视区域大小的总宽度window.innerWidth */
        #box2{
            width:98vw;
            height: 98vh;
            background-color: rgb(148, 219, 183);
        }
    </style>
</head>
<body>
    <div id="box1">
        <div id="box2"></div>
    </div>
    <div style="width: 200px;height: 100px;">
            <div id="temp1" style="margin-top: 50%">Test top</div>
            <div id="temp2" style="margin-right: 25%">Test right</div>
            <div id="temp3" style="margin-bottom: 75%">Test bottom</div>
            <div id="temp4" style="margin-left: 100%">Test left</div>
        </div>
    <div style="height: 200px; width: 400px">
            <div id="temp1" style="position: relative; top: 50%">Test top</div>
            <div id="temp2" style="position: relative; right: 25%">Test right</div>
            <div id="temp3" style="position: relative; bottom: 75%">Test bottom</div>
            <div id="temp4" style="position: relative; left: 100%">Test left</div>
        </div>
</body>
</html>